package cn.com.lms.business.learning.persistence.entity;

import io.swagger.v3.oas.annotations.media.Schema;
import lombok.ToString;

import javax.persistence.*;
import java.util.List;
import java.util.Objects;

@Entity
@Table(name = "bnz_learning_stage", schema = "bnzj", catalog = "")
@ToString
public class FbLearningStage {
    private long id;
    @Schema(description = "阶段名称")
    private String stageName;
    @Schema(description = "计划ID")
    private long planId;
    @Schema(description = "是否删除0否 1是")
    private String isDelete;

    private List<FbLearningStageDetail> stageDetails;

    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Column(name = "id")
    public long getId() {
        return id;
    }

    public void setId(long id) {
        this.id = id;
    }

    @Basic
    @Column(name = "stage_name")
    public String getStageName() {
        return stageName;
    }

    public void setStageName(String stageName) {
        this.stageName = stageName;
    }

    @Basic
    @Column(name = "plan_id")
    public long getPlanId() {
        return planId;
    }

    public void setPlanId(long planId) {
        this.planId = planId;
    }

    @Basic
    @Column(name = "is_delete")
    public String getIsDelete() {
        return isDelete;
    }

    public void setIsDelete(String isDelete) {
        this.isDelete = isDelete;
    }

    @Transient
    public List<FbLearningStageDetail> getStageDetails() {
        return stageDetails;
    }

    public void setStageDetails(List<FbLearningStageDetail> stageDetails) {
        this.stageDetails = stageDetails;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        FbLearningStage that = (FbLearningStage) o;
        return id == that.id &&
                planId == that.planId &&
                Objects.equals(stageName, that.stageName) &&
                Objects.equals(isDelete, that.isDelete);
    }

    @Override
    public int hashCode() {
        return Objects.hash(id, stageName, planId, isDelete);
    }
}
